package com.softserveinc.interactive_board.domain;


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = Presentation.TABLE_NAME)
public class Presentation  {
	
	
	public Presentation(Long id, String name, PresentationStatus status,
			String description, User user, Date date) {
		super();
		this.id = id;
		this.name = name;
		this.status = status;
		this.description = description;
		this.user = user;
		this.date = date;
	}
	
	public Presentation(Long id) {
		this(id, "name", new PresentationStatus(), "", User.getPresentor(), new Date());
	}
	
	public Presentation() {
		this(new Long(0), "name", new PresentationStatus(), "", User.getPresentor(), new Date());
	}

	public static final int COLUMNS_MAX_LENGTH = 20;
	public static final int DESCRIPTION_COLUMN_MAX_LENGTH = 500;
	
	public static final String TABLE_NAME = "presentation";
	public static final String ID_COLUMN_NAME = "presentation_id";
	public static final String NAME_COLUMN_NAME = "name";
	public static final String PRESENTATION_STATUS_COLUMN_NAME = "presentation_status_id";
	public static final String DESCRIPTION_COLUMN_NAME = "description";
	public static final String PRESENTOR_ID_COLUMN_NAME = "user_id";
	public static final String DATE_CONDUTION_COLUMN_NAME = "date_conduction";
	
	

	@Id
	@Column(name = Presentation.ID_COLUMN_NAME)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = Presentation.NAME_COLUMN_NAME, length = Presentation.COLUMNS_MAX_LENGTH)
	private String name;
	
	@ManyToOne
	@JoinColumn(name = PresentationStatus.ID_COLUMN_NAME)
	private PresentationStatus status;
	
	@Column(name = Presentation.DESCRIPTION_COLUMN_NAME, length = Presentation.COLUMNS_MAX_LENGTH)
	private String description;

	@ManyToOne
	@JoinColumn(name = User.ID_COLUMN_NAME)
	private User user;
	
	@Temporal(TemporalType.DATE)
	@Column(name = Presentation.DATE_CONDUTION_COLUMN_NAME)
	private Date date;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public PresentationStatus getStatus() {
		return status;
	}

	public void setStatus(PresentationStatus status) {
		this.status = status;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	
}